#include <stdio.h>
#include <math.h>

int gcd(int m, int n) {
    if (n == 0) {
        return m;
    }
    return gcd(n, m % n);
}

int main(void) {
    int k = 0;
    scanf("%d", &k);
    for(int i = 0; i < k; i++) {
        int n, m;
        scanf("%d%d", &n, &m);
        if (m < 2) {
            // 总有喜欢的
            printf("1\n");
            continue;
        }
        if (m == n) {
            // 全部不喜欢
            printf("0\n");
            continue;
        }
        int all_choices = n * (n - 1);
        int unlike_choices = m * (m - 1);
        int result_a = all_choices - unlike_choices;
        int result_b = all_choices;
        int divide = gcd(result_a, result_b);
        printf("%d/%d\n", result_a / divide, result_b / divide);
    }
    return 0;
}
